<html>
<head>
<script type="text/javascript">
if (window.testRunner)
    testRunner.dumpAsText();

function test()
{
    console = document.getElementById("console");
     rowOffset = document.getElementById("row2").offsetTop;
     cellOffset = document.getElementById("cell2").offsetTop;
     console.innerText += "Table 1 row 2 top offset:" + rowOffset;
     console.innerText += "\n";
     console.innerText += "Table 1 cell 2 top offset:" + cellOffset;
     console.innerText += "\n";
    tr1Offset = document.getElementById("tr1").offsetTop;
    td1Offset = document.getElementById("td1").offsetTop;
    td2Offset = document.getElementById("td2").offsetTop;
    td3Offset = document.getElementById("td3").offsetTop;
    td4Offset = document.getElementById("td4").offsetTop;
    console.innerText += "Table 2 row 1 top offset:" + tr1Offset;
    console.innerText += "\n";
    console.innerText += "Table 2 cell 1 top offset:" + td1Offset;
    console.innerText += "\n";
    console.innerText += "Table 2 cell 2 top offset:" + td2Offset;
    console.innerText += "\n";
    console.innerText += "Table 2 cell 3 top offset:" + td3Offset;
    console.innerText += "\n";
    console.innerText += "Table 3 cell 1 top offset:" + td4Offset;
    console.innerText += "\n";
    div5Offset = document.getElementById("div5").offsetTop;
    console.innerText += "Table 4 div 1 top offset:" + div5Offset;
    console.innerText += "\n";
    console.innerText += "Test result: "
    console.innerText += (rowOffset == 50 && cellOffset == 50 && tr1Offset == 0 
        && tr1Offset == td2Offset && tr1Offset == td3Offset && td4Offset == 0 && div5Offset == 50 ? "PASS" : "FAIL");
}
</script>
</head>
<body onload="test()">
    <p>This is a regression test for <i><a href="https://bugs.webkit.org/show_bug.cgi?id=8085">https://bugs.webkit.org/show_bug.cgi?id=8085</a> Main menu positioned incorrectly on eia.org and fedex.com/us</i> and for <i><a href="https://bugs.webkit.org/show_bug.cgi?id=19094">https://bugs.webkit.org/show_bug.cgi?id=19094</a> offsetTop is wrong in cell &lt;td&gt;.</i>
    </p>
    <pre id="console"></pre>
    <table cellspacing="0" cellpadding="0">
    <tr id="row1" style="height: 50px;"><td colspan="2"></td></tr>
    <tr id="row2"><td id="cell1" style="height: 100px;"></td><td id="cell2" style="height: 20px;"><div></div></td></tr>
    </table>

   <table cellspacing="0" cellpadding="0" width="20px" border="1" align="center">
    <tr id='tr1' align="center">
        <td id='td1'>x</td>
        <td id='td2'>
            <div>This</div>is more text.
        <td id='td3'>
            And a lot more text that should have the smallest offsetTop.
        </td>
    </tr>
    </table>

<table cellspacing="0" cellpadding="0" style="background-color: orange;"><tr style="background-color:
blue;"><td id="td4" style="width: 100px; height:
500px;background-color: red"></td></tr></table>

    <table cellspacing="0" cellpadding="0"><tbody><tr>
        <td style="height: 100px;">
            <div style="margin: 50px 0px;"></div>
        </td>
        <td>
            <div id='div5'>
        </td>
    </tr></tbody></table>

</body>
</html>
